package com.yjd.back.sms.control;

import com.yjd.comm.base.control.BaseControl;
import com.yjd.comm.base.enums.DbWREnums;
import com.yjd.comm.base.model.PagerHtmlModel;
import com.yjd.comm.sms.service.ISmsRecordService;
import com.yjd.comm.util.PagerUtil;
import com.yjd.comm.util.ServletUtil;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.Map;

/**
 * Created by yjd-wap on 2017/7/17.
 */
@Scope("prototype")
@Controller
@RequestMapping("/smsInfo")
public class SmsInfoControl extends BaseControl {
    /**
     * 短信列表
     *
     * @return
     * @throws Exception
     */
    @RequestMapping("/list")
    public String list() throws Exception {
        Map<String, Object> paramMap = ServletUtil.getPageParameterMap(request);
        paramMap.put("rows", "20");
        paramMap.put("sort", "create_time desc");
        PagerHtmlModel pager = PagerUtil.getPagerHtmlModel(
                this.smsRecordService.getPageModel(paramMap, DbWREnums.READ),
                ServletUtil.getPageParameterMap(request),
                ServletUtil.getUrl("/smsInfo/list"));

        request.setAttribute("pager", pager);
        return "smsInfo.list";
    }

    @Resource
    private ISmsRecordService smsRecordService;
}
